import request from '@/utils/request'

// 查询发票主表列表
export function listInvoice(query) {
  return request({
    url: '/settle/invoice/list',
    method: 'post',
    data: query
  })
}

// 查询发票主表详细
export function getInvoice(id) {
  return request({
    url: '/settle/invoice/' + id,
    method: 'get'
  })
}

// 新增发票主表
export function addInvoice(data) {
  return request({
    url: '/settle/invoice/add',
    method: 'post',
    data: data
  })
}

// 新增B2B发票
export function addByOrder2B(data) {
  return request({
    url: '/settle/invoice/addByOrder2B',
    method: 'post',
    data: data
  })
}

// 修改发票主表
export function updateInvoice(data) {
  return request({
    url: '/settle/invoice/update',
    method: 'post',
    data: data
  })
}

// 删除发票主表
export function delInvoice(id) {
  return request({
    url: '/settle/invoice/delete/' + id,
    method: 'post'
  })
}

// 根据订单id查询发票表详细
export function getInvoiceItemByOrderId(id) {
  return request({
    url: '/settle/invoiceItem/getInvoiceItemByOrderId/' + id,
    method: 'get'
  })
}

// 查询发票明细列表
export function listInvoiceItem(query) {
  return request({
    url: '/settle/invoiceItem/itemForList',
    method: 'post',
    data: query
  })
}


// 查询发票主表详细
export function getInvoiceItem(id) {
  return request({
    url: '/settle/invoiceItem/' + id,
    method: 'get'
  })
}

export function uploadDestroyFiles(data) {
  return request({
    url: '/settle/invoiceItem/uploadFiles',
    method: 'post',
    data: data
  })
}